<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QLine Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QLine Class Reference<br /><sup><sup>[<a href="qtcore.html">QtCore</a> module]</sup></sup></h1><p>The QLine class provides a two-dimensional vector using integer
precision. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qline.html#QLine">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qline.html#QLine-2">__init__</a></b> (<i>self</i>, QPoint&#160;<i>pt1_</i>, QPoint&#160;<i>pt2_</i>)</li><li><div class="fn" /><b><a href="qline.html#QLine-3">__init__</a></b> (<i>self</i>, int&#160;<i>x1pos</i>, int&#160;<i>y1pos</i>, int&#160;<i>x2pos</i>, int&#160;<i>y2pos</i>)</li><li><div class="fn" /><b><a href="qline.html#QLine-4">__init__</a></b> (<i>self</i>, QLine)</li><li><div class="fn" />int <b><a href="qline.html#dx">dx</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qline.html#dy">dy</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qline.html#isNull">isNull</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qline.html#p1">p1</a></b> (<i>self</i>)</li><li><div class="fn" />QPoint <b><a href="qline.html#p2">p2</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qline.html#setLine">setLine</a></b> (<i>self</i>, int&#160;<i>aX1</i>, int&#160;<i>aY1</i>, int&#160;<i>aX2</i>, int&#160;<i>aY2</i>)</li><li><div class="fn" /><b><a href="qline.html#setP1">setP1</a></b> (<i>self</i>, QPoint&#160;<i>aP1</i>)</li><li><div class="fn" /><b><a href="qline.html#setP2">setP2</a></b> (<i>self</i>, QPoint&#160;<i>aP2</i>)</li><li><div class="fn" /><b><a href="qline.html#setPoints">setPoints</a></b> (<i>self</i>, QPoint&#160;<i>aP1</i>, QPoint&#160;<i>aP2</i>)</li><li><div class="fn" /><b><a href="qline.html#translate">translate</a></b> (<i>self</i>, QPoint&#160;<i>point</i>)</li><li><div class="fn" /><b><a href="qline.html#translate-2">translate</a></b> (<i>self</i>, int&#160;<i>adx</i>, int&#160;<i>ady</i>)</li><li><div class="fn" />QLine <b><a href="qline.html#translated">translated</a></b> (<i>self</i>, QPoint&#160;<i>p</i>)</li><li><div class="fn" />QLine <b><a href="qline.html#translated-2">translated</a></b> (<i>self</i>, int&#160;<i>adx</i>, int&#160;<i>ady</i>)</li><li><div class="fn" />int <b><a href="qline.html#x1">x1</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qline.html#x2">x2</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qline.html#y1">y1</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qline.html#y2">y2</a></b> (<i>self</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QLine <b><a href="qtgui.html#__mul__-4">__mul__</a></b> (<i>self</i>, QMatrix&#160;<i>m</i>)</li><li><div class="fn" />QLine <b><a href="qtgui.html#__mul__-10">__mul__</a></b> (<i>self</i>, QTransform&#160;<i>m</i>)</li><li><div class="fn" />int <b><a href="qline.html#__bool__">__bool__</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qline.html#__eq__">__eq__</a></b> (<i>self</i>, QLine&#160;<i>d</i>)</li><li><div class="fn" />bool <b><a href="qline.html#__ne__">__ne__</a></b> (<i>self</i>, QLine&#160;<i>d</i>)</li><li><div class="fn" />str <b><a href="qline.html#__repr__">__repr__</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>The QLine class provides a two-dimensional vector using integer
precision.</p>
<p>A QLine describes a finite length line (or a line segment) on a
two-dimensional surface. The start and end points of the line are
specified using integer point accuracy for coordinates. Use the
<a href="qlinef.html">QLineF</a> constructor to retrieve a floating
point copy.</p>
<table class="generic">
<tr class="odd" valign="top">
<td><img src="images/qline-point.png" /></td>
<td><img src="images/qline-coordinates.png" /></td>
</tr>
</table>
<p>The positions of the line's start and end points can be
retrieved using the <a href="qline.html#p1">p1</a>(), <a href="qline.html#x1">x1</a>(), <a href="qline.html#y1">y1</a>(),
<a href="qline.html#p2">p2</a>(), <a href="qline.html#x2">x2</a>(),
and <a href="qline.html#y2">y2</a>() functions. The <a href="qline.html#dx">dx</a>() and <a href="qline.html#dy">dy</a>()
functions return the horizontal and vertical components of the
line. Use <a href="qline.html#isNull">isNull</a>() to determine
whether the QLine represents a valid line or a null line.</p>
<p>Finally, the line can be translated a given offset using the
<a href="qline.html#translate">translate</a>() function.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QLine" />QLine.__init__ (<i>self</i>)</h3><p>Constructs a null line.</p>


<h3 class="fn"><a name="QLine-2" />QLine.__init__ (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pt1_</i>, <a href="qpoint.html">QPoint</a>&#160;<i>pt2_</i>)</h3><p>Constructs a line object that represents the line between
<i>p1</i> and <i>p2</i>.</p>


<h3 class="fn"><a name="QLine-3" />QLine.__init__ (<i>self</i>, int&#160;<i>x1pos</i>, int&#160;<i>y1pos</i>, int&#160;<i>x2pos</i>, int&#160;<i>y2pos</i>)</h3><p>Constructs a line object that represents the line between
(<i>x1</i>, <i>y1</i>) and (<i>x2</i>, <i>y2</i>).</p>


<h3 class="fn"><a name="QLine-4" />QLine.__init__ (<i>self</i>, <a href="qline.html">QLine</a>)</h3><h3 class="fn"><a name="dx" />int QLine.dx (<i>self</i>)</h3><p>Returns the horizontal component of the line's vector.</p>
<p><b>See also</b> <a href="qline.html#dy">dy</a>().</p>


<h3 class="fn"><a name="dy" />int QLine.dy (<i>self</i>)</h3><p>Returns the vertical component of the line's vector.</p>
<p><b>See also</b> <a href="qline.html#dx">dx</a>().</p>


<h3 class="fn"><a name="isNull" />bool QLine.isNull (<i>self</i>)</h3><p>Returns true if the line is not set up with valid start and end
point; otherwise returns false.</p>


<h3 class="fn"><a name="p1" /><a href="qpoint.html">QPoint</a> QLine.p1 (<i>self</i>)</h3><p>Returns the line's start point.</p>
<p><b>See also</b> <a href="qline.html#setP1">setP1</a>(), <a href="qline.html#x1">x1</a>(), <a href="qline.html#y1">y1</a>(), and
<a href="qline.html#p2">p2</a>().</p>


<h3 class="fn"><a name="p2" /><a href="qpoint.html">QPoint</a> QLine.p2 (<i>self</i>)</h3><p>Returns the line's end point.</p>
<p><b>See also</b> <a href="qline.html#setP2">setP2</a>(), <a href="qline.html#x2">x2</a>(), <a href="qline.html#y2">y2</a>(), and
<a href="qline.html#p1">p1</a>().</p>


<h3 class="fn"><a name="setLine" />QLine.setLine (<i>self</i>, int&#160;<i>aX1</i>, int&#160;<i>aY1</i>, int&#160;<i>aX2</i>, int&#160;<i>aY2</i>)</h3><p>Sets this line to the start in <i>x1</i>, <i>y1</i> and end in
<i>x2</i>, <i>y2</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qline.html#setP1">setP1</a>(), <a href="qline.html#setP2">setP2</a>(), <a href="qline.html#p1">p1</a>(),
and <a href="qline.html#p2">p2</a>().</p>


<h3 class="fn"><a name="setP1" />QLine.setP1 (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>aP1</i>)</h3><p>Sets the starting point of this line to <i>p1</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qline.html#setP2">setP2</a>() and
<a href="qline.html#p1">p1</a>().</p>


<h3 class="fn"><a name="setP2" />QLine.setP2 (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>aP2</i>)</h3><p>Sets the end point of this line to <i>p2</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qline.html#setP1">setP1</a>() and
<a href="qline.html#p2">p2</a>().</p>


<h3 class="fn"><a name="setPoints" />QLine.setPoints (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>aP1</i>, <a href="qpoint.html">QPoint</a>&#160;<i>aP2</i>)</h3><p>Sets the start point of this line to <i>p1</i> and the end point
of this line to <i>p2</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qline.html#setP1">setP1</a>(), <a href="qline.html#setP2">setP2</a>(), <a href="qline.html#p1">p1</a>(),
and <a href="qline.html#p2">p2</a>().</p>


<h3 class="fn"><a name="translate" />QLine.translate (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>point</i>)</h3><p>Translates this line by the given <i>offset</i>.</p>


<h3 class="fn"><a name="translate-2" />QLine.translate (<i>self</i>, int&#160;<i>adx</i>, int&#160;<i>ady</i>)</h3><p>This is an overloaded function.</p>
<p>Translates this line the distance specified by <i>dx</i> and
<i>dy</i>.</p>


<h3 class="fn"><a name="translated" /><a href="qline.html">QLine</a> QLine.translated (<i>self</i>, <a href="qpoint.html">QPoint</a>&#160;<i>p</i>)</h3><p>Returns this line translated by the given <i>offset</i>.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="translated-2" /><a href="qline.html">QLine</a> QLine.translated (<i>self</i>, int&#160;<i>adx</i>, int&#160;<i>ady</i>)</h3><p>This is an overloaded function.</p>
<p>Returns this line translated the distance specified by <i>dx</i>
and <i>dy</i>.</p>
<p>This function was introduced in Qt 4.4.</p>


<h3 class="fn"><a name="x1" />int QLine.x1 (<i>self</i>)</h3><p>Returns the x-coordinate of the line's start point.</p>
<p><b>See also</b> <a href="qline.html#p1">p1</a>().</p>


<h3 class="fn"><a name="x2" />int QLine.x2 (<i>self</i>)</h3><p>Returns the x-coordinate of the line's end point.</p>
<p><b>See also</b> <a href="qline.html#p2">p2</a>().</p>


<h3 class="fn"><a name="y1" />int QLine.y1 (<i>self</i>)</h3><p>Returns the y-coordinate of the line's start point.</p>
<p><b>See also</b> <a href="qline.html#p1">p1</a>().</p>


<h3 class="fn"><a name="y2" />int QLine.y2 (<i>self</i>)</h3><p>Returns the y-coordinate of the line's end point.</p>
<p><b>See also</b> <a href="qline.html#p2">p2</a>().</p>


<h3 class="fn"><a name="__mul__-4" /><a href="qline.html">QLine</a> __mul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>&#160;<i>m</i>)</h3><p>This method is only available if the QtGui module is imported.</p><h3 class="fn"><a name="__mul__-10" /><a href="qline.html">QLine</a> __mul__ (<i>self</i>, <a href="qtransform.html">QTransform</a>&#160;<i>m</i>)</h3><p>This method is only available if the QtGui module is imported.</p><h3 class="fn"><a name="__bool__" />int QLine.__bool__ (<i>self</i>)</h3><h3 class="fn"><a name="__eq__" />bool QLine.__eq__ (<i>self</i>, <a href="qline.html">QLine</a>&#160;<i>d</i>)</h3><h3 class="fn"><a name="__ne__" />bool QLine.__ne__ (<i>self</i>, <a href="qline.html">QLine</a>&#160;<i>d</i>)</h3><h3 class="fn"><a name="__repr__" />str QLine.__repr__ (<i>self</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>